/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.cvut.fel.taskpro.business.imanager;

import cz.cvut.fel.taskpro.business.support.BusinessRuleException;
import cz.cvut.fel.taskpro.data.entity.Assignment;
import cz.cvut.fel.taskpro.data.entity.AssignmentSubmit;
import cz.cvut.fel.taskpro.data.entity.GroupTaskPro;
import cz.cvut.fel.taskpro.data.entity.Kantor;
import cz.cvut.fel.taskpro.data.entity.Student;
import cz.cvut.fel.taskpro.data.entity.Team;
import java.util.List;
import javax.ejb.Local;

/**
 * This interface specify responsible action of business manager, which is
 * responsible for working with team.
 * @author Tom
 * @version 1.0.0. beta
 */
@Local
public interface ITeamBusiness  {
    /**
     * This method add new team to db. Method ask business validator to validate 
     * newTeam and then ask daataLayer for persist new object. If business validator
     * find that newTeam is in incompatible state with business logic then BusinessRuleException 
     * is invoke.
     * @param newTeam new team to add to DB. Validation will be done on this variable.
     */
    public void addTeam(Team newTeam) throws BusinessRuleException;
    /**
     * This method add all student from teamToMerge to oldTeam and then update oldTeam
     * all process must be validate via business rule validator.If business validator
     * find that teamToMerge is in incompatible state with business logic then
     * BusinessRuleException is invoke. The method ask dataLayer for upadete oldTeam
     * after validation.
     * @param oldTeam old version of team.
     * @param teamToMerge new team which will replce old team. Validation will be done.
     */
    public void addStudentToTeam(Team oldTeam,Team teamToMerge) throws BusinessRuleException;
    /**
     * This method ask dataLayer for all team which belongs to kantor in parameter.
     * @param kantor kantor who is responsible for manage team, which will be found.
     * @return list of all team which belongs to kantor in param.
     */
    public List<Team> getTeamsByKantor(Kantor kantor);
    /**
     * This method ask data layer for all teams which are in groups in parameter.
     * @param groups groups in which are founded team.
     * @return list of all teams which are in groups in param.
     */
    public List<Team> getTeamsByGroup(List<GroupTaskPro> groups);
    /**
     * This method ask dataLayer for all teams in which is student in parameter.
     * @param student student who is memeber of founded teams.
     * @return list of all teams in which is student in parameter.
     */
    public List<Team> getTeamsByStudent(Student student);
    /** 
     * This method ask data layer for remov team in parameter. Team must satisfy 
     * conditions in business rule validator. If business validator
     * find that teamToRemove is in incompatible state with business logic then
     * BusinessRuleException is invoke. The method remove team from assignemts.
     * @param teamToRemove team which will be removed from DB and which assignment 
     * will be found
     */
    public void removeTeam(Team teamToRemove)throws BusinessRuleException;
    
    /**
     * This method remove students from team in param. Team must pass throught
     * business validation first. If no, then BusinessRuleException is invoke.
     * If team has any submitted assingmnet, then this operation is not permitted.
     * @param studentsToRemove students who will be removed from team. Business validation is done.
     * @param teamInStudents team from which will be students removed. Business validation is done.
     */
    public void removeStudentsFromTeam(Team teamInStudents,List<Student> studentsToRemove)throws BusinessRuleException;
}
